package com.gitee.zzh;

import com.gitee.zzh.sqllineage.vo.TableColumnInfo;

import java.util.*;

public class TableColumnInfoImpl implements TableColumnInfo {
    @Override
    public List<Map<String, String>> getColumnsByTableName(String tableName) {
        List<Map<String, String>> list = new ArrayList<>();
        for (String row : TABLE_COLUMN_STRING.split("\n")) {
            String table = row.substring(0, row.indexOf("\t"));
            if(table.equals(tableName)) {
                String column = row.substring(table.length() + "\t".length());
                Map<String, String> map = new HashMap<>();
                map.put("COLUMN_NAME", column);
                list.add(map);
            }
        }
        return list;
    }

    private static final String TABLE_COLUMN_STRING = "FR_TABLE_SOURCE1\tSOURCE1_COL1\n" +
            "FR_TABLE_SOURCE1\tSOURCE1_COL2\n" +
            "FR_TABLE_SOURCE1\tSOURCE1_COL3\n" +
            "FR_TABLE_SOURCE2\tSOURCE2_COL1\n" +
            "FR_TABLE_SOURCE2\tSOURCE2_COL2\n" +
            "FR_TABLE_SOURCE2\tSOURCE2_COL3\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL1\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL2\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL3\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL4\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL5\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL6\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL7\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL8\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL9\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL10\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL11\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL12\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL13\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL14\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL15\n" +
            "JO_TABLE_SOURCE3\tSOURCE3_COL16\n" +
            "JO_TABLE_SOURCE4\tSOURCE4_COL1\n" +
            "JO_TABLE_SOURCE4\tSOURCE4_COL2\n" +
            "JO_TABLE_SOURCE4\tSOURCE4_COL3\n" +
            "JO_TABLE_SOURCE4\tSOURCE4_COL4\n" +
            "JO_TABLE_SOURCE4\tSOURCE4_COL5\n" +
            "JO_TABLE_SOURCE5\tSOURCE5_COL1\n" +
            "JO_TABLE_SOURCE5\tSOURCE5_COL2\n" +
            "JO_TABLE_SOURCE5\tSOURCE5_COL3\n" +
            "TARGET_TABLE2\tTARGET2_COL_ID\n" +
            "TARGET_TABLE2\tTARGET2_COL1\n" +
            "TARGET_TABLE2\tTARGET2_COL2\n" +
            "TARGET_TABLE2\tTARGET2_COL3\n" +
            "TARGET_TABLE2\tTARGET2_COL4\n" +
            "TARGET_TABLE2\tTARGET2_COL5\n" +
            "TARGET_TABLE2\tTARGET2_COL6\n" +
            "TARGET_TABLE2\tTARGET2_COL7\n" +
            "TARGET_TABLE2\tTARGET2_COL8\n" +
            "TARGET_TABLE2\tTARGET2_COL9\n" +
            "TARGET_TABLE2\tTARGET2_COL10\n" +
            "TARGET_TABLE2\tTARGET2_COL11\n" +
            "TARGET_TABLE2\tTARGET2_COL12\n" +
            "TARGET_TABLE2\tTARGET2_COL13\n" +
            "TARGET_TABLE2\tTARGET2_COL14\n" +
            "TARGET_TABLE2\tTARGET2_COL15\n" +
            "TABLE_IL_EL00000000035\tIL_COL1\n" +
            "TABLE_IL_EL00000000035\tIL_COL2\n" +
            "TABLE_IL_EL00000000035\tIL_COL3\n" +
            "TABLE_IL_EL00000000035\tIL_COL4\n" +
            "WH_TABLE_SOURCE6\tSOURCE6_COL1\n" +
            "WH_TABLE_SOURCE6\tSOURCE6_COL2\n" +
            "WH_TABLE_SOURCE6\tSOURCE6_COL3\n" +
            "WH_TABLE_SOURCE6\tSOURCE6_COL4\n" +
            "WH_TABLE_SOURCE6\tSOURCE6_COL5\n" +
            "WH_TABLE_SOURCE6\tSOURCE6_COL6\n" +
            "WH_TABLE_SOURCE6\tSOURCE6_COL7\n" +
            "WH_TABLE_SOURCE6\tSOURCE6_COL8\n" +
            "WH_TABLE_SOURCE6\tSOURCE6_COL9\n" +
            "WH_TABLE_SOURCE6\tSOURCE6_COL10\n" +
            "WH_TABLE_SOURCE6\tSOURCE6_COL11\n" +
            "WH_TABLE_SOURCE6\tSOURCE6_COL12\n" +
            "SE_TABLE_SOURCE7\tSOURCE7_COL1\n" +
            "SE_TABLE_SOURCE7\tSOURCE7_COL2";

}
